<?php
$name = $_POST['uname'];
$pass = $_POST['upass'];


$link = mysqli_connect('localhost','root','root','test');

    $res = mysqli_query($link,"SELECT * FROM `user` WHERE  `username` = '$name' AND `password` = '$pass'");

    $row = mysqli_fetch_assoc($res);
    $r = json_encode($row);
    if($res) {
      $arr = array('message' => '登陆成功' , 'code' => 1 ,'res' => $r);
    }else {
      $arr = array('message' => '登陆失败' , 'code' => 0 );
    };
    print_r(json_encode($arr))
    // print_r(json_encode($id))
?>